﻿using System;
using System.Collections.Generic;
using DevExpress.XtraEditors.Repository;

namespace DXApplicationTangche.UC.订单
{
    internal class RepositoryItemComboBox下拉框 : RepositoryItemComboBox
    {
        private List<String> optionValues = new List<String>();
        private String optionValue;
        public RepositoryItemComboBox下拉框(List<String> optionValues)
        {
            this.optionValues = optionValues;
            this.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.AutoHeight = false;
            this.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.Name = "repositoryItemComboBox下拉框";
            foreach (String optionValue in this.optionValues)
            {
                this.Items.Add(optionValue);
            }
            this.AutoHeight = false;
            //  event
            this.SelectedIndexChanged += RepositoryItemComBox下拉框_SelectedIndexChanged;
        }

        private void RepositoryItemComBox下拉框_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i = ((DevExpress.XtraEditors.ComboBoxEdit)sender).SelectedIndex;
            this.optionValue = this.optionValues[i].ToString();
            
        }
    }
}